home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / super30a.zip / SMUTIL.ZIP / SAMPLE.C < prev    next >
Text File  |  1991-12-17  |  955b  |  51 lines

  1. /*************************************************************************
  2. *                                         *
  3. * SAMPLE.C                                 *
  4. *                                         *
  5. *************************************************************************/
  6.  
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9.  
  10. void main(int argc,char *argv[]);
  11. void endgood(int,int,int);
  12. int smplad(int,int);
  13. int second_function(void);
  14. int third_function(void);
  15.  
  16. #define smplad(x,y) ((x)+(y))
  17.  
  18. void main(int argc,char *argv[])
  19. {
  20.     int a,b,x;
  21.  
  22.      if (argc<3)
  23.     {
  24.         printf("\nUseage:  sample Num1 Num2\n");
  25.         endgood(2,a,b);
  26.     }
  27.     a=atoi(argv[1]);
  28.     b=atoi(argv[2]);
  29.  
  30.     if ((x=second_function())==1)
  31.     if ((x=third_function())==1)
  32.         endgood(1,a,b);
  33.     else
  34.         endgood(2,a,b);
  35. }
  36.  
  37. void endgood(int num,int a, int b)
  38. {
  39.     if (num==1)
  40.     {
  41.         printf("\n%d + %d = %d",a,b,smplad(a,b));
  42.         printf("\nThis is a good Exit.\n");
  43.         exit(0);
  44.     }
  45.     else
  46.     {
  47.         printf("\nThis is a bad Exit.\n");
  48.         exit(0);
  49.     }
  50. }
  51.